﻿package mortal.game.view.platform.platformTencent
{
    import Message.DB.Tables.*;
    import com.mui.containers.globalVariable.*;
    import com.mui.controls.*;
    import fl.data.*;
    import flash.events.*;
    import mortal.game.resource.*;
    import mortal.game.resource.info.item.*;
    import mortal.game.view.common.*;
    import mortal.game.view.platform.*;

    public class PlatformQQDailyCellRender extends GCellRenderer
    {
        private var _itemList:GTileList;
        private var _vipIcon:GImageBitmap;
        private var _getBtn:GLoadingButton;
        private var _canGetTip:GImageBitmap;
        private var _giftData:TPlatformGift;

        public function PlatformQQDailyCellRender()
        {
            return;
        }// end function

        override public function set data(param1:Object) : void
        {
            super.data = param1;
            this._giftData = param1 as TPlatformGift;
            this._itemList.dataProvider = this.getDataProviderByGiftCode(this._giftData.reward);
            this._itemList.x = 54 + 108 - 50 - 0.5 * (this._itemList.dataProvider.length * 43);
            this._itemList.drawNow();
            var _loc_2:* = PlatformTencentUtil.getQQVipIconUrl({proxyLv:this._giftData.pLv});
            this._vipIcon.imgUrl = _loc_2;
            this._canGetTip.visible = false;
            if (PlatformVIPGiftsUtil.getReceiveTypeByTPlatformGift(this._giftData, false) == PlatformVIPGiftGroup.CanReceive)
            {
                this._canGetTip.visible = true;
            }
            if (PlatformTencentUtil.isYellowEnter())
            {
                this.setYellow(param1);
            }
            else if (PlatformTencentUtil.isBlueEnter())
            {
                this.setBlue(param1);
            }
            return;
        }// end function

        override protected function createDisposedChildrenImpl() : void
        {
            super.createDisposedChildrenImpl();
            this._itemList = UIFactory.tileList(54 + 108 - 33, 6 + 5, 500, 40, this);
            this._itemList.columnWidth = 43;
            this._itemList.rowHeight = 40;
            this._itemList.setStyle("cellRenderer", PlatformVIPItemCellRender);
            this._itemList.direction = GBoxDirection.HORIZONTAL;
            this._vipIcon = UIFactory.gImageBitmap("", 5 + 6, 10 + 4 + 5, this);
            this._canGetTip = UIFactory.gImageBitmap(ImagesConst.QQBlueCanGetTip, 210 - 23, 50 - 32 + 5, this);
            this._canGetTip.visible = false;
            if (PlatformTencentUtil.isYellowEnter())
            {
                this.createYellow();
            }
            else if (PlatformTencentUtil.isBlueEnter())
            {
                this.createBlue();
            }
            return;
        }// end function

        private function onClickHandle(event:MouseEvent) : void
        {
            return;
        }// end function

        private function setYellow(param1) : void
        {
            return;
        }// end function

        private function setBlue(param1) : void
        {
            return;
        }// end function

        private function createYellow() : void
        {
            return;
        }// end function

        private function createBlue() : void
        {
            return;
        }// end function

        override protected function disposeImpl(param1:Boolean = true) : void
        {
            this._itemList.dispose(param1);
            this._itemList = null;
            if (this._canGetTip)
            {
                this._canGetTip.dispose(param1);
                this._canGetTip = null;
            }
            if (this._getBtn)
            {
                this._getBtn.dispose(param1);
                this._getBtn = null;
            }
            if (this._vipIcon)
            {
                this._vipIcon.dispose(param1);
                this._vipIcon = null;
            }
            this._giftData = null;
            super.disposeImpl(param1);
            return;
        }// end function

        private function getDataProviderByGiftCode(param1:int) : DataProvider
        {
            var _loc_5:Array = null;
            var _loc_6:ItemData = null;
            var _loc_9:PlatformVIPItemGroup = null;
            var _loc_2:* = new DataProvider();
            var _loc_3:* = new ItemData(param1).itemInfo as ItemGiftBagInfo;
            var _loc_4:* = _loc_3.itemList1.split("&");
            var _loc_7:* = _loc_4.length;
            var _loc_8:int = 0;
            while (_loc_8 < _loc_4.length)
            {
                
                _loc_5 = _loc_4[_loc_8].split("#");
                _loc_9 = new PlatformVIPItemGroup();
                _loc_9.itemCode = int(_loc_5[1]);
                _loc_9.itemAmount = _loc_5[2];
                _loc_9.isBind = true;
                _loc_2.addItem(_loc_9);
                _loc_8++;
            }
            return _loc_2;
        }// end function

    }
}
